package sanrenxing.dayEnd.backRepertoryTotal.dao;

import org.apache.ibatis.annotations.*;
import sanrenxing.dayEnd.backRepertoryTotal.domain.Stocksector;

import java.util.List;
import java.util.Map;


public interface StocksectorDao {
    /**
     * 将基金实体添加数据库基金表中
     * @param stocksector 基金对象
     * @return 0:添加失败,1:添加成功
     */
    @Insert("insert into stocksector(stockId,stockName,notes)" +
            "values(seqStocksector.nextval,#{stockName},#{notes})")
    public int add(Stocksector stocksector);
    /**
     * 从表中根据基金编号删除一行数据
     * @param stockId 基金编号
     * @return 删除影响的行数(0:删除失败,1:删除成功)
     */
    @Delete("delete from stocksector where stockId=#{stockId}")
    public int delete(@Param("stockId") int stockId);
    /**
     * 修改数据到foundation表
     * @param stocksector 员工对象
     * @return 0:修改失败,1:修改成功
     */
    @Update("update stocksector set stockName=#{stockName},notes=#{notes} where stockId=#{stockId}")
    public int update(Stocksector stocksector);

//    @Select("<script>" +
//            "select * from " +
//            " (select rownum rn,stocksector.* from stocksector " +
//            " <where>#{end}>=rownum</where>)" +
//            "<where>" +
//            "<if test='stocksector.stockId!=null'>" +
//            " and stockId like '%${foundation.stockId}%'" +
//            "</if>" +
//            "<if test='foundation.fundName!=null'>" +
//            " and fundName like '%${foundation.fundName}%'" +
//            "</if>" +
//            " and rn>=#{start}" +
//            "</where>" +
//            "</script>")
    @Select("select * from stocksector")
    @Results({
            @Result(property = "stockId",column = "stockId"),
            @Result(property = "stockName",column = "stockName"),
            @Result(property = "notes",column = "notes")
    })
    public List<Stocksector> queryAll(Map<String, Object> map);
    /**
     * 统计记录数
     * @param
     * @return 记录行数据
     */
    @Select("select count(*) from stocksector")
    public int count();



}
